package com.dmy.common.entity;

import lombok.Data;

import java.io.Serializable;

/**
 * create by huahuadelei for 2020/1/4
 */
@Data
public class ResultBean implements Serializable {
    private String code;
    private String msg;
    private Object data;

    public ResultBean(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResultBean success(){
        return new ResultBean("200","ok",null);
    }

    public static ResultBean success(Object data){
        return new ResultBean("200","ok",data);
    }

    public static ResultBean buildResult(String code){
        return new ResultBean(code,null,null);
    }
    public ResultBean msg(String msg){
        this.msg = msg;
        return this;
    }
    public ResultBean data(Object data){
        this.data = data;
        return this;
    }
}
